#pragma once

#include "Includes.h"

class VMTWrapper
{
private:
	static void**& getvtable(void* inst, size_t offset = 0);
	static const void** getvtable(const void* inst, size_t offset = 0);
public:
	template<typename Fn> static Fn getfunction(const void* inst, size_t index, size_t offset = 0);
};

template<typename Fn> static Fn VMTWrapper::getfunction(const void* inst, size_t index, size_t offset/* = 0*/)
{
	return reinterpret_cast<Fn>(getvtable(inst, offset)[index]);
}